package com.example.myserver;

import android.app.IntentService;
import android.content.Intent;
import android.content.Context;
public class MyIntentService extends IntentService {

    public MyIntentService() {
        super("MyIntentService");
    }
    public static void startActionFoo(Context context, String param1, String param2) {

    }
    public static void startActionBaz(Context context, String param1, String param2) {

    }

    @Override
    protected void onHandleIntent(Intent intent) {
    long endTime = System.currentTimeMillis() + 20 * 1000;
        System.out.println("OnStartCommand");
        while (System.currentTimeMillis()< endTime){
            synchronized (this){
                try {
                    wait(endTime - System.currentTimeMillis());
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
        System.out.println("耗时任务完成");
    }
    private void handleActionFoo(String param1, String param2) {

    }
    private void handleActionBaz(String param1, String param2) {

    }
}